package com.allenjsl.springactuator.controller;

import com.allenjsl.springactuator.service.RemoteLoggerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderConsulController {
    public static final String INVOME_URL = "http://boot-micrometer";

    @Autowired
    private RemoteLoggerService remoteLoggerService;


    @Resource
    private RestTemplate restTemplate;
    @GetMapping("/consumer/payment/consul")
    public String payment (){
        String result = restTemplate.getForObject(INVOME_URL+"/logger/loglevel",String.class);
        return result;
    }

    @GetMapping("/consumer/payment/feign")
    public String paymentFeign (){
        String result = remoteLoggerService.getServiceInfo();
        return result;
    }
}
